﻿<Window x:Class="Daytimer.Controls.ContextTextFormatter"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Daytimer.Controls"
		xmlns:System="clr-namespace:System;assembly=mscorlib" Title="ContextTextFormatter" Height="71" Width="230"
		AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize"
		SnapsToDevicePixels="True" UseLayoutRounding="True" TextOptions.TextFormattingMode="Display"
		TextOptions.TextRenderingMode="ClearType" ShowActivated="False" ShowInTaskbar="False">
	<Border>
		<Border.Effect>
			<DropShadowEffect ShadowDepth="0" Opacity="0.5" Color="#FFBBBBBB" />
		</Border.Effect>
		<Border x:Name="Border" Background="White" BorderThickness="1" BorderBrush="#FFC7C7C7" Margin="4">
			<Grid Margin="3,5">
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition Height="3" />
					<RowDefinition />
				</Grid.RowDefinitions>
				<Grid.Resources>
					<Style x:Key="CommandButton" TargetType="Button">
						<Setter Property="Width" Value="22" />
						<Setter Property="Height" Value="24" />
						<Setter Property="Background" Value="Transparent" />
						<Setter Property="Focusable" Value="False" />
						<Setter Property="Template">
							<Setter.Value>
								<ControlTemplate TargetType="Button">
									<Border Background="{TemplateBinding Background}">
										<Image
												Source="{Binding Content, RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}"
												Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" />
									</Border>
									<ControlTemplate.Triggers>
										<Trigger Property="IsMouseOver" Value="True">
											<Setter Property="Background" Value="{StaticResource RibbonMouseOver}" />
										</Trigger>
										<Trigger Property="IsPressed" Value="True">
											<Setter Property="Background" Value="{StaticResource RibbonPressed}" />
										</Trigger>
									</ControlTemplate.Triggers>
								</ControlTemplate>
							</Setter.Value>
						</Setter>
					</Style>
					<Style x:Key="CommandToggleButton" TargetType="ToggleButton">
						<Setter Property="Width" Value="22" />
						<Setter Property="Height" Value="24" />
						<Setter Property="Background" Value="Transparent" />
						<Setter Property="BorderBrush" Value="Transparent" />
						<Setter Property="Focusable" Value="False" />
						<Setter Property="Template">
							<Setter.Value>
								<ControlTemplate TargetType="ToggleButton">
									<Border Background="{TemplateBinding Background}" BorderThickness="1"
											BorderBrush="{TemplateBinding BorderBrush}">
										<Image
												Source="{Binding Content, RelativeSource={RelativeSource FindAncestor, AncestorType=ToggleButton}}"
												Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" />
									</Border>
									<ControlTemplate.Triggers>
										<Trigger Property="IsMouseOver" Value="True">
											<Setter Property="Background" Value="{StaticResource RibbonMouseOver}" />
											<Setter Property="BorderBrush" Value="{StaticResource RibbonMouseOver}" />
										</Trigger>
										<Trigger Property="IsChecked" Value="True">
											<Setter Property="Background" Value="{StaticResource RibbonChecked}" />
											<Setter Property="BorderBrush" Value="{StaticResource RibbonChecked}" />
										</Trigger>
										<Trigger Property="IsPressed" Value="True">
											<Setter Property="Background" Value="{StaticResource RibbonPressed}" />
											<Setter Property="BorderBrush" Value="{StaticResource RibbonPressed}" />
										</Trigger>
										<MultiTrigger>
											<MultiTrigger.Conditions>
												<Condition Property="IsMouseOver" Value="True" />
												<Condition Property="IsChecked" Value="True" />
												<Condition Property="IsPressed" Value="False" />
											</MultiTrigger.Conditions>
											<Setter Property="Background" Value="{StaticResource RibbonMouseOver}" />
										</MultiTrigger>
									</ControlTemplate.Triggers>
								</ControlTemplate>
							</Setter.Value>
						</Setter>
					</Style>
				</Grid.Resources>
				<StackPanel Orientation="Horizontal">
					<ComboBox x:Name="fontFamilyBox" IsEditable="True" Width="98" Height="24" MaxDropDownHeight="443"
							IsTextSearchEnabled="False" ToolTip="Font" Focusable="False"
							VirtualizingStackPanel.IsVirtualizing="True" DropDownOpened="fontFamilyBox_DropDownOpened"
							SelectionChanged="fontFamilyBox_SelectionChanged"
							PreviewKeyDown="fontFamilyBox_PreviewKeyDown" LostFocus="fontFamilyBox_LostFocus">
						<ComboBox.ItemTemplate>
							<DataTemplate DataType="System:String">
								<Grid IsHitTestVisible="False">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="Auto" />
										<ColumnDefinition />
									</Grid.ColumnDefinitions>
									<TextBlock Text="{Binding}" VerticalAlignment="Center" />
									<TextBlock Grid.Column="1" Text="The quick brown fox" HorizontalAlignment="Right"
											VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
											Margin="10,0,0,0"
											FontFamily="{Binding IsAsync=True, FallbackValue=Segoe UI}" FontSize="14" />
								</Grid>
							</DataTemplate>
						</ComboBox.ItemTemplate>
						<ComboBox.Resources>
							<!--<Style TargetType="ComboBoxItem" BasedOn="{StaticResource ComboBoxItemStyle}">
								<Setter Property="FontFamily"
										Value="{Binding Content, RelativeSource={RelativeSource Self}}" />
								<Setter Property="FontSize" Value="15" />
								<Setter Property="Height" Value="24" />
								<Setter Property="Padding" Value="5,0" />
								<Setter Property="VerticalContentAlignment" Value="Center" />
								<Setter Property="MaxWidth" Value="250" />
							</Style>-->
							<Style TargetType="ComboBoxItem" BasedOn="{StaticResource ComboBoxItemStyle}">
								<!--<Setter Property="FontFamily"
												Value="{Binding Content, RelativeSource={RelativeSource Self}, IsAsync=True, FallbackValue=Segoe UI}" />-->
								<!--<Setter Property="FontSize" Value="15" />-->
								<Setter Property="Height" Value="24" />
								<Setter Property="Padding" Value="5,0" />
								<Setter Property="VerticalContentAlignment" Value="Center" />
								<Setter Property="HorizontalContentAlignment" Value="Stretch" />
								<Setter Property="MaxWidth" Value="250" />
							</Style>
						</ComboBox.Resources>
					</ComboBox>
					<ComboBox x:Name="fontSizeBox" IsEditable="True" Width="42" Height="24" Margin="2,0,0,0"
							ToolTip="Font Size" Focusable="False" SelectionChanged="fontSizeBox_SelectionChanged"
							IsTextSearchEnabled="False" IsEnabled="{Binding IsEnabled, ElementName=increaseSize}"
							PreviewKeyDown="fontSizeBox_PreviewKeyDown" LostFocus="fontSizeBox_LostFocus">
						<ComboBoxItem Content="8" />
						<ComboBoxItem Content="9" />
						<ComboBoxItem Content="10" />
						<ComboBoxItem Content="11" />
						<ComboBoxItem Content="12" />
						<ComboBoxItem Content="14" />
						<ComboBoxItem Content="16" />
						<ComboBoxItem Content="18" />
						<ComboBoxItem Content="20" />
						<ComboBoxItem Content="22" />
						<ComboBoxItem Content="24" />
						<ComboBoxItem Content="26" />
						<ComboBoxItem Content="28" />
						<ComboBoxItem Content="36" />
						<ComboBoxItem Content="48" />
						<ComboBoxItem Content="72" />
					</ComboBox>
					<Button x:Name="increaseFontSizeButton" Style="{StaticResource CommandButton}"
							Command="EditingCommands.IncreaseFontSize" ToolTip="Increase Font Size (Ctrl+&gt;)"
							Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/increasesize.png" />
					<Button x:Name="decreaseFontSizeButton" Style="{StaticResource CommandButton}"
							Command="EditingCommands.DecreaseFontSize" ToolTip="Decrease Font Size (Ctrl+&lt;)"
							Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/decreasesize.png" />
					<Button x:Name="clearFormatting" Style="{StaticResource CommandButton}"
							ToolTip="Clear All Formatting" Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/clearformatting.png"
							Click="clearFormatting_Click" />
				</StackPanel>
				<StackPanel Orientation="Horizontal" Grid.Row="2">
					<ToggleButton x:Name="boldButton" Style="{StaticResource CommandToggleButton}"
							Command="EditingCommands.ToggleBold" ToolTip="Bold (Ctrl+B)"
							Content="pack://application:,,,/Daytimer.Images;component/Images/bold.png" />
					<ToggleButton x:Name="italicButton" Style="{StaticResource CommandToggleButton}"
							Command="EditingCommands.ToggleItalic" ToolTip="Italic (Ctrl+I)" Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/italic.png" />
					<ToggleButton x:Name="underlineButton" Style="{StaticResource CommandToggleButton}"
							Command="local:ContextTextFormatter.UnderlineCommand" ToolTip="Underline (Ctrl+U)"
							Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/underline.png" />
					<ToggleButton x:Name="strikethroughButton" Style="{StaticResource CommandToggleButton}"
							Command="local:ContextTextFormatter.StrikethroughCommand" ToolTip="Strikethrough"
							Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/strikethrough.png" />
					<local:SplitHighlightPicker x:Name="highlightColor" Width="34" Height="24" Margin="2,0,0,0"
							ToolTip="Text Highlight Color" Focusable="False"
							ButtonImage="pack://application:,,,/Daytimer.Images;component/Images/highlightcolor.png"
							OnSelectedChangedEvent="highlightColor_OnSelectedChangedEvent" />
					<local:SplitColorPicker x:Name="fontColor" Width="34" Height="24" Margin="2,0,0,0"
							ToolTip="Font Color" Focusable="False"
							ButtonImage="pack://application:,,,/Daytimer.Images;component/Images/fontcolor.png"
							OnSelectedChangedEvent="fontColor_OnSelectedChangedEvent" />
					<ToggleButton x:Name="toggleBullets" Style="{StaticResource CommandToggleButton}"
							Command="EditingCommands.ToggleBullets" Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/bullets.png"
							ToolTip="Bullets" Checked="toggleBullets_Checked" />
					<ToggleButton x:Name="toggleNumbers" Style="{StaticResource CommandToggleButton}"
							Command="EditingCommands.ToggleNumbering" Margin="2,0,0,0"
							Content="pack://application:,,,/Daytimer.Images;component/Images/numbers.png"
							ToolTip="Numbering" Checked="toggleNumbers_Checked" />
				</StackPanel>
			</Grid>
		</Border>
	</Border>
</Window>
